package com.ll.throwsdemo;

/**
 * @author 刘龙
 * @version 1.0
 */
public class ThrowsDetail {
    public static void main(String[] args) throws ArithmeticException{
        f2();
    }

    public static void f2() throws ArithmeticException{
        double d2 = 2 / 0;
    }
}

class Father {
    public void method() throws RuntimeException {

    }
}

//class Son extends Father {
//    @Override
//    /**
//     * 错误 Exception 是 RuntimeException 的父类
//     */
//    public void method() throws Exception {
//        super.method();
//    }
//}

class Son2 extends Father {
    @Override
    /**
     * 正确 NullPointerException 是 RuntimeException 的子类
     */
    public void method() throws NullPointerException {
        super.method();

    }
}
